Optimal. Leaf size=264 \[ \frac {\left (a^2-2 b^2\right ) \cos ^{-1+m}(c+d x) \sin (c+d x)}{d m (2+m)}-\frac {2 a b \cos ^m(c+d x) \sin (c+d x)}{d \left (2+3 m+m^2\right )}-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}-\frac {\left (a^2 (1-m)-b^2 (2+m)\right ) \cos ^{-1+m}(c+d x) \, _2F_1\left (\frac {1}{2},\frac {1}{2} (-1+m);\frac {1+m}{2};\cos ^2(c+d x)\right ) \sin (c+d x)}{d (1-m) m (2+m) \sqrt {\sin ^2(c+d x)}}-\frac {2 a b \cos ^m(c+d x) \, _2F_1\left (\frac {1}{2},\frac {m}{2};\frac {2+m}{2};\cos ^2(c+d x)\right ) \sin (c+d x)}{d m (1+m) \sqrt {\sin ^2(c+d x)}} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.52, antiderivative size = 264, normalized size of antiderivative = 1.00, number of steps
used = 8, number of rules used = 7, integrand size = 28, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.250, Rules used = {4482, 2968,
3129, 3112, 3102, 2827, 2722} \begin {gather*} -\frac {\left (a^2 (1-m)-b^2 (m+2)\right ) \sin (c+d x) \cos ^{m-1}(c+d x) \, _2F_1\left (\frac {1}{2},\frac {m-1}{2};\frac {m+1}{2};\cos ^2(c+d x)\right )}{d (1-m) m (m+2) \sqrt {\sin ^2(c+d x)}}+\frac {\left (a^2-2 b^2\right ) \sin (c+d x) \cos ^{m-1}(c+d x)}{d m (m+2)}-\frac {2 a b \sin (c+d x) \cos ^m(c+d x) \, _2F_1\left (\frac {1}{2},\frac {m}{2};\frac {m+2}{2};\cos ^2(c+d x)\right )}{d m (m+1) \sqrt {\sin ^2(c+d x)}}-\frac {2 a b \sin (c+d x) \cos ^m(c+d x)}{d \left (m^2+3 m+2\right )}-\frac {\sin (c+d x) \cos ^{m-1}(c+d x) (a \cos (c+d x)+b)^2}{d (m+2)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 2722
Rule 2827
Rule 2968
Rule 3102
Rule 3112
Rule 3129
Rule 4482
Rubi steps
\begin {align*} \int \cos ^m(c+d x) (a \sin (c+d x)+b \tan (c+d x))^2 \, dx &=\int \cos ^{-2+m}(c+d x) (b+a \cos (c+d x))^2 \sin ^2(c+d x) \, dx\\ &=\int \cos ^{-2+m}(c+d x) (b+a \cos (c+d x))^2 \left (1-\cos ^2(c+d x)\right ) \, dx\\ &=-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}+\frac {\int \cos ^{-2+m}(c+d x) (b+a \cos (c+d x)) \left (3 b+a \cos (c+d x)-2 b \cos ^2(c+d x)\right ) \, dx}{2+m}\\ &=-\frac {2 a b \cos ^m(c+d x) \sin (c+d x)}{d \left (2+3 m+m^2\right )}-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}+\frac {\int \cos ^{-2+m}(c+d x) \left (3 b^2 (1+m)+2 a b (2+m) \cos (c+d x)+\left (a^2-2 b^2\right ) (1+m) \cos ^2(c+d x)\right ) \, dx}{2+3 m+m^2}\\ &=\frac {\left (a^2-2 b^2\right ) \cos ^{-1+m}(c+d x) \sin (c+d x)}{d m (2+m)}-\frac {2 a b \cos ^m(c+d x) \sin (c+d x)}{d \left (2+3 m+m^2\right )}-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}+\frac {\int \cos ^{-2+m}(c+d x) \left (-(1+m) \left (a^2 (1-m)-b^2 (2+m)\right )+2 a b m (2+m) \cos (c+d x)\right ) \, dx}{m \left (2+3 m+m^2\right )}\\ &=\frac {\left (a^2-2 b^2\right ) \cos ^{-1+m}(c+d x) \sin (c+d x)}{d m (2+m)}-\frac {2 a b \cos ^m(c+d x) \sin (c+d x)}{d \left (2+3 m+m^2\right )}-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}+\frac {(2 a b) \int \cos ^{-1+m}(c+d x) \, dx}{1+m}-\frac {\left (a^2 (1-m)-b^2 (2+m)\right ) \int \cos ^{-2+m}(c+d x) \, dx}{m (2+m)}\\ &=\frac {\left (a^2-2 b^2\right ) \cos ^{-1+m}(c+d x) \sin (c+d x)}{d m (2+m)}-\frac {2 a b \cos ^m(c+d x) \sin (c+d x)}{d \left (2+3 m+m^2\right )}-\frac {\cos ^{-1+m}(c+d x) (b+a \cos (c+d x))^2 \sin (c+d x)}{d (2+m)}-\frac {\left (a^2 (1-m)-b^2 (2+m)\right ) \cos ^{-1+m}(c+d x) \, _2F_1\left (\frac {1}{2},\frac {1}{2} (-1+m);\frac {1+m}{2};\cos ^2(c+d x)\right ) \sin (c+d x)}{d (1-m) m (2+m) \sqrt {\sin ^2(c+d x)}}-\frac {2 a b \cos ^m(c+d x) \, _2F_1\left (\frac {1}{2},\frac {m}{2};\frac {2+m}{2};\cos ^2(c+d x)\right ) \sin (c+d x)}{d m (1+m) \sqrt {\sin ^2(c+d x)}}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains higher order function than in optimal. Order 6 vs. order 5 in
optimal.
time = 29.92, size = 6669, normalized size = 25.26 \begin {gather*} \text {Result too large to show} \end {gather*}
Warning: Unable to verify antiderivative.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.42, size = 0, normalized size = 0.00 \[\int \left (\cos ^{m}\left (d x +c \right )\right ) \left (a \sin \left (d x +c \right )+b \tan \left (d x +c \right )\right )^{2}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (a \sin {\left (c + d x \right )} + b \tan {\left (c + d x \right )}\right )^{2} \cos ^{m}{\left (c + d x \right )}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [F]
time = 0.00, size = -1, normalized size = -0.00 \begin {gather*} \int {\cos \left (c+d\,x\right )}^m\,{\left (a\,\sin \left (c+d\,x\right )+b\,\mathrm {tan}\left (c+d\,x\right )\right )}^2 \,d x \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________